<html>
<head><meta charset="utf-8"><title>Setting up rust-analyzer · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Setting.20up.20rust-analyzer.html">Setting up rust-analyzer</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="225483470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Setting%20up%20rust-analyzer/near/225483470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hrishi Dharam <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Setting.20up.20rust-analyzer.html#225483470">(Feb 07 2021 at 20:59)</a>:</h4>
<p>Hello! I'm trying to set up rust-analyzer locally by following the instructions in <a href="https://github.com/rust-lang/rust-clippy/blob/master/CONTRIBUTING.md#getting-code-completion-for-rustc-internals-to-work">CONTRIBUTING.md</a> file: <br>
I've got two questions: </p>
<ol>
<li>After I run the <code>cargo dev ra_setup</code> command, and run a <code>cargo test</code>, I see the format test fails. I think this is expected based on the error message but I'd like to confirm that. </li>
</ol>
<div class="codehilite"><pre><span></span><code>running 1 test
test fmt ... FAILED

failures:

---- fmt stdout ----
status: exit code: 1
stdout:
stderr:     Finished dev [unoptimized + debuginfo] target(s) in 0.18s
     Running `clippy_dev/target/debug/clippy_dev fmt --check`
error: a local rustc repo is enabled as path dependency via `cargo dev ra_setup`.
Not formatting because that would format the local repo as well!
Please revert the changes to Cargo.tomls first.

thread &#39;fmt&#39; panicked at &#39;Formatting check failed. Run `cargo dev fmt` to update formatting.&#39;, tests/fmt.rs:32:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
</code></pre></div>
<ol start="2">
<li>Rust-analyzer (the vscode plugin) still doesn't seem to detect the types from the rustc local repo after I run the <code>ra_setup</code> subcommand. Do I need to build the rustc repo for it to work with rust-analyzer?</li>
</ol>
<p>Thank you for your help. Apologies if these are noob questions, I am new to rust :)</p>



<a name="225484044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Setting%20up%20rust-analyzer/near/225484044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nahua <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Setting.20up.20rust-analyzer.html#225484044">(Feb 07 2021 at 21:12)</a>:</h4>
<p>Not sure if it's correlated but today I have had a lot of troubles with VS Code + <code>rust-analyzer</code>. <code>cargo</code> commands show <code>Force-skipping unavailable component 'rustfmt-x86_64-unknown-linux-gnu'</code>and <code>rust-analyzer</code> has trouble running for my <code>clippy</code> fork. </p>
<p>No problem on any other <code>rust-lang</code> repos. But I've never setup code-completion for rustc internals so I'm not familiar with problems on <code>cargo dev ra_setup</code> <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> </p>
<p>Have you modified the repo? Does running <code>cargo dev fmt</code> fix the issue?</p>



<a name="225484833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Setting%20up%20rust-analyzer/near/225484833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hrishi Dharam <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Setting.20up.20rust-analyzer.html#225484833">(Feb 07 2021 at 21:28)</a>:</h4>
<p>I did try running <code>cargo dev fmt</code>, before making any local changes. The error message led me to believe that this error is expected if rustc is enabled as a local dependency. </p>
<div class="codehilite"><pre><span></span><code>~/Doc/p/rust-dev/rust-clippy master !2 ❯ cargo dev fmt                                                         proxy 16:27:00
    Finished dev [unoptimized + debuginfo] target(s) in 0.22s
     Running `clippy_dev/target/debug/clippy_dev fmt`
error: a local rustc repo is enabled as path dependency via `cargo dev ra_setup`.
Not formatting because that would format the local repo as well!
Please revert the changes to Cargo.tomls first.
</code></pre></div>



<a name="225485516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Setting%20up%20rust-analyzer/near/225485516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ThibsG <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Setting.20up.20rust-analyzer.html#225485516">(Feb 07 2021 at 21:42)</a>:</h4>
<blockquote>
<ol>
<li>After I run the cargo dev ra_setup command, and run a cargo test, I see the format test fails. I think this is expected based on the error message but I'd like to confirm that.</li>
</ol>
</blockquote>
<p>Yes this is expected to prevent committing local rustc paths in <code>Cargo.toml</code>.</p>
<blockquote>
<ol start="2">
<li>Rust-analyzer (the vscode plugin) still doesn't seem to detect the types from the rustc local repo after I run the ra_setup subcommand. Do I need to build the rustc repo for it to work with rust-analyzer?</li>
</ol>
</blockquote>
<p>Building rustc is not required, but sometimes I need to restart VSCode (especially when Rust-Analyzer needs an update).<br>
Another thing I've done is to add the folder of rustc to my VSCode workspace (not sure it will work though...) .</p>



<a name="225502647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Setting%20up%20rust-analyzer/near/225502647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Setting.20up.20rust-analyzer.html#225502647">(Feb 08 2021 at 04:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="374205">Nahua</span> <a href="#narrow/stream/257328-clippy/topic/Setting.20up.20rust-analyzer/near/225484044">said</a>:</p>
<blockquote>
<p>Not sure if it's correlated but today I have had a lot of troubles with VS Code + <code>rust-analyzer</code>. <code>cargo</code> commands show <code>Force-skipping unavailable component 'rustfmt-x86_64-unknown-linux-gnu'</code>and <code>rust-analyzer</code> has trouble running for my <code>clippy</code> fork. </p>
</blockquote>
<p>information about this is presented here: <a href="https://rust-lang.github.io/rustup/concepts/channels.html#nightly-availability">https://rust-lang.github.io/rustup/concepts/channels.html#nightly-availability</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>